<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>渠道商列表</title>
<link rel="stylesheet" type="text/css" href="../WEB-UI/GlobalRes/Components/JQuery/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href=".../WEB-UI/GlobalRes/Components/JQuery/themes/icon.css">
<script type="text/javascript" src="../WEB-UI/GlobalRes/Components/JQuery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../WEB-UI/GlobalRes/Components/JQuery/jquery.easyui.min.js"></script>

<script language="javascript" type="text/javascript">
		    $(function() {		    			    	
		    	$('#lptable').datagrid({
		    		title:'渠道商列表',
					width:1130,
					height:550,
					nowrap: false,
					striped: true,
					collapsible:false,
					url:'../agency/loadingAgency.action',
					sortName: 'agencyCode',
					sortOrder: 'asc',
					remoteSort: true,
					idField:'agencyCode',
					ColumnHeadersHeader:15,
					fitColumns: true,
					rownumbers:true,
					singleSelect:false,
					toolbar:[{
						text:'增    加',
						handler:function(){$('#w').window('open');}
					},{
						text:'修    改',
						handler:function(){alert('cut')}
					},'-',{
						text:'删    除',
						handler:function(){alert('save')}
					}],
					pagination:true,
					frozenColumns:[],
					columns:[[{field:'ck',checkbox:true},
						{field:'agencyCode',title:'渠道商编码',width:80,sortable:true,styler:function(value,rowData,rowIndex){return 'color:#296AAA';}},
						{field:'agencyName',title:'渠道商名称',width:150,sortable:true},
				    	{field:'comments',title:'描述信息',width:200,sortable:true,styler:function(value,rowData,rowIndex){return 'color:#4F8911';}},
				    	{field:'recDate',title:'创建时间',width:100,sortable:true},
						{field:'auditId',title:'创建者',width:70,sortable:true}
					]],
					pagination:true}).datagrid('getPager').pagination({
						pageSize: 15,//每页显示的记录条数，默认为10   
				        pageList: [15],//可以设置每页记录条数的列表   
				        beforePageText: '第',//页数文本框前显示的汉字   
				        afterPageText: '页    共 {pages} 页',   
				        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
						onBeforeRefresh:function(pageNumber,pageSize){
							$(this).pagination('loading');
							$(this).pagination('loaded');
						}
					});
		    });
	</script>
</head>
<body>
<div class="main">
	<div class="hzlp_content">
		<div class="hzlp_search">
			<table id="lptable" cellspacing="0" cellpadding="0"></table>
		</div>
	</div>
</div>
<div id="w" class="easyui-window" title="新增渠道商" data-options="modal:true,closed:true" style="width:500px;height:300px;padding:10px;">
		<div style="padding:10px 150px 10px 10px">
		<form id="ff">
	    	<table>
	    		<tr>
	    			<td>渠道商编码：</td>
	    			<td><input class="easyui-validatebox" type="text" name="appCode" data-options="required:true"></input></td>
	    		</tr>
	    		<tr>
	    			<td>渠道商名称：</td>
	    			<td><input class="easyui-validatebox" type="text" name="appName" data-options="required:true"></input></td>
	    		</tr>
	    		<tr>
	    			<td>描述信息：</td>
	    			<td><textarea name="appDesc" style="height:60px;"></textarea></td>
	    		</tr>
	    	</table>
	    </form>
	    </div>
	    <div style="text-align:center;padding:5px">
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清除</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeWin()">关闭</a>
	    </div>
	<script>
		function submitForm(){
			var formdata = $("#ff").serialize();
			$.post("agency/addAgency.action",formdata,function(result){
				if('success'==result){
					$('#lptable').datagrid('reload');
					$('#w').window('close');
				}
				else{
					alert("增加应用信息失败，请重新增加！");
				}
			});
		}
		function clearForm(){
			$('#ff').form('clear');
		}
		function closeWin(){
			$('#w').window('close');
		}
	</script>
</div>
</body>
</html>